import { _decorator, Component, Button } from 'cc';
import RowFallClear_GameManager, { GameType } from '../Manager/RowFallClear_GameManager';
// import RowFallClear_GameManager, { GameType } from "../Manager/GameManager";

const { ccclass, property } = _decorator;

@ccclass('RowFallClear_StartPanel')
export default class RowFallClear_StartPanel extends Component {
    public static Instance: RowFallClear_StartPanel;
    @property(Button)
    Button_normal: Button | null = null;
    @property(Button)
    Button_speed: Button | null = null;
    onLoad() {
        RowFallClear_StartPanel.Instance = this;
    }
    start() {
        // 普通模式
        this.Button_normal.node.on('click', (button) => {
            RowFallClear_StartPanel.Instance.ShowOff();
            RowFallClear_GameManager.Instance.gameType = GameType.Normal;
            RowFallClear_GameManager.Instance.GameStart();
        }, this);

        // 竞速模式
        this.Button_speed.node.on('click', (button) => {
            RowFallClear_StartPanel.Instance.ShowOff();
            RowFallClear_GameManager.Instance.gameType = GameType.Speed;
            RowFallClear_GameManager.Instance.GameStart();
        }, this);
    }
    ShowOn() {
        this.node.active = true;
    }
    ShowOff() {
        this.node.active = false;
    }
}